import 'package:flutter/material.dart';

main() => runApp(OpacityApp());

class OpacityApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  bool _visible = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        centerTitle: true,
        title: Text('Materilal App Bar'),
      ),
      body: AnimatedOpacity(
        child: Center(
          child: Image.network(
              'https://images.techhive.com/images/idge/imported/article/ctw/2012/09/19/android-logo-100381000-orig.jpg'),
        ),
        opacity: _visible ? 1.0 : 0.0,
        duration: Duration(milliseconds: 500),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.flip),
        onPressed: () {
          setState(() {
            _visible = !_visible;
          });
        },
      ),
    );
  }
}
